namespace Blog2025.Domain.Events;

/// <summary>
/// 用户创建事件
/// </summary>
public class UserCreatedEvent : IDomainEvent
{
    /// <summary>
    /// 事件唯一标识
    /// </summary>
    public Guid EventId { get; }

    /// <summary>
    /// 用户ID
    /// </summary>
    public Guid UserId { get; }

    /// <summary>
    /// 用户名
    /// </summary>
    public string Username { get; }

    /// <summary>
    /// 昵称
    /// </summary>
    public string? Nickname { get; }

    /// <summary>
    /// 部门ID
    /// </summary>
    public Guid? DepartmentId { get; }

    /// <summary>
    /// 事件发生时间
    /// </summary>
    public DateTime OccurredOn { get; }

    public UserCreatedEvent(Guid userId, string username, string? nickname = null, Guid? departmentId = null)
    {
        EventId = Guid.NewGuid();
        UserId = userId;
        Username = username;
        Nickname = nickname;
        DepartmentId = departmentId;
        OccurredOn = DateTime.UtcNow;
    }
}
